/**
 * loading 加载插件
 */
;(function ($) {
    'use strict';

    $.showLoading = (opt) => {
        opt = opt || {};
        opt.text = opt.text || '加载中...';
        const html = `<div class="m-loading-icon"></div><div class="m-loading-text">${opt.text}</div>`;
        const tpl = `<div class="m-mask-transparent"></div><div class="m-loading">${html}</div>`
        $(tpl).appendTo(document.body);
    };

    $.hideLoading = (callback) => {
        $('.m-loading, .m-mask-transparent').remove();
        if (callback) callback(this);
    };

})($);